#include "mainwindow.h"
#include "ui_mainwindow.h"

/* 文本提示
 * 在指定的文本框中打印指定提示文本，并设定提示文本的字体大小和颜色
 */
void MainWindow::InsertText(QTextEdit* te_prin, QString text, int fontSize, QColor fontColor)
{
    QString s_time = QTime::currentTime().toString("hh:mm:ss");
    s_time = '[' + s_time + ']';
    QTextCharFormat fmt;
    //字体色
    fmt.setForeground(QBrush(fontColor));
    //字体大小
    fmt.setFontPointSize(fontSize);
    //取消选中并移动光标至当前内容末尾
    te_prin->moveCursor(QTextCursor::End);
    //文本框使用以上设定
    te_prin->mergeCurrentCharFormat(fmt);
    //文本框添加文本
    text = s_time + ' ' + text;
    te_prin->append("     "+text);
    //移动光标至当前内容末尾
    te_prin->moveCursor(QTextCursor::End);
}
// 按钮切换-连接按钮
void MainWindow::LangureStr_Init_Btn_Link(QPushButton* btn_link)
{
    if(LangureStu == 1)
    {
        LangureStr = "Connect";
    }
    else
    {
        LangureStr = "连  接";
    }
    btn_link->setText(LangureStr);
}
// 按钮切换-断开按钮
void MainWindow::LangureStr_Init_Btn_Unlink(QPushButton* btn_unlink)
{
    if(LangureStu == 1)
    {
        LangureStr = "Disconnect";
    }
    else
    {
        LangureStr = "断  开";
    }
    btn_unlink->setText(LangureStr);
}
// 语言字符串初始化-断开
void MainWindow::LangureStr_Init_Unlink()
{
    if(LangureStu == 1)
    {
        LangureStr = "Disconnect";
    }
    else
    {
        LangureStr = "未连接";
    }
}
// 语言字符串初始化-已断开
void MainWindow::LangureStr_Init_Disconnected()
{
    if(LangureStu == 1)
    {
        LangureStr = "Disconnected";
    }
    else
    {
        LangureStr = "已断开连接";
    }
}
// 打印信息-设备检测中
void MainWindow::LangureStr_Init_Testing(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Equipment testing";
    }
    else
    {
        LangureStr = "设备检测中";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-设备连接失败
void MainWindow::LangureStr_Init_LinkFailed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Device connection failed";
    }
    else
    {
        LangureStr = "设备连接失败";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 语言字符串初始化-没有可以连接的端口
void MainWindow::LangureStr_Init_NotConnected(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "No ports can be connected";
    }
    else
    {
        LangureStr = "没有可以连接的端口";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-已连接
void MainWindow::LangureStr_Init_Connected(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Device connected";
    }
    else
    {
        LangureStr = "设备已连接";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-设备超时
void MainWindow::LangureStr_Init_TimeOut(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "The device timed out, Please check the device connection status and try again!";
    }
    else
    {
        LangureStr = "设备超时，请检查设备连接状态后重试!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-设备繁忙
void MainWindow::LangureStr_Init_Busy(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "The device is busy, please operate later!";
    }
    else
    {
        LangureStr = "设备繁忙，请稍后操作!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-文件打开失败
void MainWindow::LangureStr_Init_FileOpenFail(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Cannot open file!";
    }
    else
    {
        LangureStr = "不能打开文件!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 打印信息-文件不存在
void MainWindow::LangureStr_Init_FileNonExistent(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "File non-existent!";
    }
    else
    {
        LangureStr = "文件不存在!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 打印信息-原彩数据大小必须为16K
void MainWindow::LangureStr_Init_LimitFileSize(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN Data size must be 16kb!";
    }
    else
    {
        LangureStr = "原彩数据大小必须为16KB!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-盖板码写入中
void MainWindow::LangureStr_Init_BurningCode(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN is burning...";
    }
    else
    {
        LangureStr = "盖板码写入中...";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-盖板码（替换底层）写入中
void MainWindow::LangureStr_Init_BurningCode_DevData(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN(Replace underlying) is burning...";
    }
    else
    {
        LangureStr = "盖板码(替换底层)写入中...";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-写入盖板码完成
void MainWindow::LangureStr_Init_BurnCode_Succeed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN burning succeeded";
    }
    else
    {
        LangureStr = "盖板码写入成功";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_SUCCESS);
}
// 打印信息-写入盖板码（替换底层）完成
void MainWindow::LangureStr_Init_BurnCode_DevData_Succeed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN(Replace underlying) burning succeeded";
    }
    else
    {
        LangureStr = "盖板码(替换底层)写入成功";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_SUCCESS);
}
// 打印信息-写入盖板码失败
void MainWindow::LangureStr_Init_BurnCode_Failed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN burning Failed";
    }
    else
    {
        LangureStr = "盖板码写入失败";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 打印信息-写入盖板码（替换底层）失败
void MainWindow::LangureStr_Init_BurnCode_DevData_Failed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN(Replace underlying) burning Failed";
    }
    else
    {
        LangureStr = "盖板码(替换底层)写入失败";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 打印信息-等待设备写入数据
void MainWindow::LangureStr_Init_BurnData_WaitDev(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data transmission is completed, Wait for the device to write data";
    }
    else
    {
        LangureStr = "传输数据完成，等待设备写入数据...";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-数据读取中
void MainWindow::LangureStr_Init_ReadingData(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data Reading...";
    }
    else
    {
        LangureStr = "数据读取中...";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-读取数据完成
void MainWindow::LangureStr_Init_ReadData_Succeed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data read successfully!";
    }
    else
    {
        LangureStr = "数据读取成功!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_SUCCESS);
}
// 打印信息-读取数据失败
void MainWindow::LangureStr_Init_ReadData_Failed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data read failed!";
    }
    else
    {
        LangureStr = "数据读取失败!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 打印信息-数据写入中
void MainWindow::LangureStr_Init_BurningData(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data Writing...";
    }
    else
    {
        LangureStr = "数据写入中...";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_NORMAL);
}
// 打印信息-数据写入完成
void MainWindow::LangureStr_Init_BurnData_Succeed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data writing succeeded";
    }
    else
    {
        LangureStr = "数据写入成功";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_SUCCESS);
}
// 打印信息-数据写入失败
void MainWindow::LangureStr_Init_BurnData_Failed(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "Data write failed";
    }
    else
    {
        LangureStr = "数据写入失败";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_FAILED);
}
// 打印信息-写入盖板码失败，设备忙
void MainWindow::LangureStr_Init_BurnCode_Failed_Busy(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN burning failed, The device is busy, please operate later!";
    }
    else
    {
        LangureStr = "盖板码写入失败，设备繁忙，请稍后操作!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-写入盖板码失败，设备忙
void MainWindow::LangureStr_Init_BurnCode_DevData_Failed_Busy(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN(Replace underlying) burning failed, The device is busy, please operate later!";
    }
    else
    {
        LangureStr = "盖板码(替换底层)写入失败，设备繁忙，请稍后操作!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-写入盖板码失败，设备超时
void MainWindow::LangureStr_Init_BurnCode_Failed_Time(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN burning failed, The device timed out. Please check the device connection status and try again!";
    }
    else
    {
        LangureStr = "盖板码写入失败，设备超时，请检查设备连接状态后重试!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-写入盖板码失败，设备超时
void MainWindow::LangureStr_Init_BurnCode_DevData_Failed_Time(QTextEdit *te_prin)
{
    if(LangureStu == 1)
    {
        LangureStr = "MtSN(Replace underlying) burning failed, The device timed out. Please check the device connection status and try again!";
    }
    else
    {
        LangureStr = "盖板码(替换底层)写入失败，设备超时，请检查设备连接状态后重试!";
    }
    InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-设备版本低
void MainWindow::LangureStr_Init_DevVers_Low(QTextEdit *te_prin, QByteArray BinVersion)
{
	if(LangureStu == 1)
	{
        LangureStr = "The device version is low, and can be upgraded to "+BinVersion+"\n"
					 "\tCheck the upgrade confirmation box and click \"Upgrade\" button.";
	}
	else
	{
        LangureStr = "设备版本低,当前可升级为"+BinVersion+"\n"
					 "\t勾选升级确认框，单击\"升级\"按钮";
	}
	InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 打印信息-软件版本低
void MainWindow::LangureStr_Init_AppVers_Low(QTextEdit *te_prin)
{
	if(LangureStu == 1)
	{
        LangureStr = "Assistant version is low, please go to the official website or contact customer service to determine whether the assistant is the latest version";
	}
	else
	{
        LangureStr = "助手版本低,请前往官方网站或联系客服确定助手是否为最新版本";
    }
	InsertText(te_prin, LangureStr, NORMAL_FONT_SIZE, APP_FONT_COLOR_WARNNING);
}
// 连接按钮语言切换
void MainWindow::Btn_Link_Langure_to_Change(QPushButton* btn_link)
{
    QString DestStr;
    QString BtnStr;

    BtnStr = btn_link->text();
    if(LangureStu == 1)
    {
        if(BtnStr == "连  接")
        {
            DestStr = "Connect";
        }
        else
        {
            DestStr = "Disconnect";
        }
    }
    else
    {
        if(BtnStr == "Connect")
        {
            DestStr = "连  接";
        }
        else
        {
            DestStr = "断  开";
        }
    }
    btn_link->setText(DestStr);
}
void MainWindow::Btn_Link_Langure_to_Set(QPushButton* btn_link)
{
    if(LangureStu == 1)
    {
        btn_link->setText("Connect");
    }
    else
    {
        btn_link->setText("连  接");
    }
}
// 版本语言切换
void MainWindow::Lbl_Ver_Langure_to_Change()
{
    if(ui->btn_left_mtsn_f210->isChecked() == false)
	{
        ui->lbl_dev_ver->setText("");
		return;
	}
    QString DestStr;
    QString LblStr;

    LblStr = ui->lbl_dev_ver->text();
    if(LangureStu == 1)
    {
        if(LblStr == "当前设备版本号：未识别")
        {
            DestStr = "Current equipment version number: unrecognized";
        }
        else
        {
            DestStr = "Current equipment version number: "+DevVersion;
        }
    }
    else
    {
        if(LblStr == "Current equipment version number: unrecognized")
        {
            DestStr = "当前设备版本号：未识别";
        }
        else
        {
            DestStr = "当前设备版本号："+DevVersion;
        }
    }
    ui->lbl_dev_ver->setText(DestStr);
}
// 版本语言切换
void MainWindow::Lbl_Ver_F316_Langure_to_Change()
{
    if(ui->btn_left_loop_f316->isChecked() == false)
	{
        ui->lbl_ver_f316->setText("");
		return;
	}
    QString DestStr;
    QString LblStr;

    LblStr = ui->lbl_ver_f316->text();
    if(LangureStu == 1)
    {
        if(LblStr == "当前设备版本号：未识别")
        {
            DestStr = "Current equipment version number: unrecognized";
        }
        else
        {
            DestStr = "Current equipment version number: "+DevVer_f316;
        }
    }
    else
    {
        if(LblStr == "Current equipment version number: unrecognized")
        {
            DestStr = "当前设备版本号：未识别";
        }
        else
        {
            DestStr = "当前设备版本号："+DevVer_f316;
        }
    }
    ui->lbl_ver_f316->setText(DestStr);
}
// 版本语言切换
void MainWindow::Lbl_Ver_dl8000_Langure_to_Change()
{
    if(ui->btn_left_dl8000->isChecked() == false)
	{
        ui->lbl_ver_dl8000->setText("");
		return;
	}
    QString DestStr;
    QString LblStr;

    LblStr = ui->lbl_ver_dl8000->text();
    if(LangureStu == 1)
    {
        if(LblStr == "当前设备版本号：未识别")
        {
            DestStr = "Current equipment version number: unrecognized";
        }
        else
        {
            DestStr = "Current equipment version number: "+DevVer_dl8000;
        }
    }
    else
    {
        if(LblStr == "Current equipment version number: unrecognized")
        {
            DestStr = "当前设备版本号：未识别";
        }
        else
        {
            DestStr = "当前设备版本号："+DevVer_dl8000;
        }
    }
    ui->lbl_ver_dl8000->setText(DestStr);
}


/* 软件语言切换函数
 */
void MainWindow::App_Langure_to_Change()
{
    if(LangureStu == 1)
    {
        AppTitle = "Lighting Assistant";

        ui->btn_left_mtsn_f210->setText("Original Color");
		ui->btn_left_bat_f210->setText("Battery Repair");
        ui->btn_left_disp_f210->setText("Display Repair");
        ui->btn_left_mtsn_dlbox->setText("Original Color");
        ui->btn_left_cfg_dlbox->setText("Upgrade Configuration");
        ui->btn_left_sql_dlbox->setText("SQL Configuration");
        ui->btn_left_loop_f316->setText("Battery Loop");
        ui->btn_left_dl8000->setText("Original Color");
        ui->btn_ContactUs->setText("Contact us");
		ui->btn_menu_drive->setText("DRIVE");
		ui->btn_menu_langure->setText("简体中文");

        ui->btn_menu_menu->setToolTip("Menu");
        ui->btn_menu_max->setToolTip("Maximize");
        ui->btn_menu_min->setToolTip("Minimize");
        ui->btn_menu_close->setToolTip("Close");

        ui->btn_ContactUs->setMinimumSize(100,30);
        ui->btn_ContactUs->setMaximumSize(100,30);
    }
    else
    {
        AppTitle = "点亮智能助手";

        ui->btn_left_mtsn_f210->setText("原彩修复");
		ui->btn_left_bat_f210->setText("电池修复");
        ui->btn_left_disp_f210->setText("显示修复");
        ui->btn_left_mtsn_dlbox->setText("原彩修复");
        ui->btn_left_cfg_dlbox->setText("升级配置");
        ui->btn_left_sql_dlbox->setText("数据库配置");
        ui->btn_left_loop_f316->setText("电池循环");
        ui->btn_left_dl8000->setText("原彩修复");
        ui->btn_ContactUs->setText("联系我们");
		ui->btn_menu_drive->setText("驱动");
		ui->btn_menu_langure->setText("ENGLISH");

        ui->btn_menu_menu->setToolTip("菜单");
        ui->btn_menu_max->setToolTip("最大化");
        ui->btn_menu_min->setToolTip("最小化");
        ui->btn_menu_close->setToolTip("关闭");

        ui->btn_ContactUs->setMinimumSize(75,30);
        ui->btn_ContactUs->setMaximumSize(75,30);
    }
    F210_Langure_Change_Init();
    F210_Code_Langure_Change_Init();
    TextBox_Langure_Change_Init();
    TextBox_CFG_Langure_Change_Init();
    b316_BatLoop_Langure_Change_Init();
	dl8000_Langure_Change_Init();

    hexEdit->Langure_Change(LangureStu);
    hexEdit_dlbox->Langure_Change(LangureStu);
    hexEdit_code_f210->Langure_Change(LangureStu);

    ui->lbl_title->setText(AppTitle);
    this->setWindowTitle(AppTitle);
}
// F210界面语言切换初始化
void MainWindow::F210_Langure_Change_Init()
{
    if(LangureStu == 1)
    {
        // F210
        ui->cbx_dev->setText("Replace underlying");
        ui->lbl_model_read->setText("Selected model: ");
        ui->btn_mtsn_read->setText("Read MtSN");
        ui->btn_mtsn_write->setText("Burn MtSN");
        ui->btn_read->setText("Save Data");
        ui->btn_write->setText("Burn Data");
        ui->btn_upg->setText("Upgrade");

        ui->te_mtsn->setPlaceholderText("MtSN");
        ui->te_file_write->setPlaceholderText("Choose File");

        ui->lbl_model_read->setMinimumSize(120,30);
        ui->lbl_model_read->setMaximumSize(120,30);
        ui->btn_link->setMinimumSize(120,35);
        ui->btn_link->setMaximumSize(120,35);
        ui->btn_link_bat->setMinimumSize(120,35);
        ui->btn_link_bat->setMaximumSize(120,35);
        ui->lbl_dev_ver->setMinimumSize(380,30);
        ui->lbl_dev_ver->setMaximumSize(380,30);
		
		// 电池修复
        ui->btn_read_data_bat->setText("READ");
        ui->btn_write_data_bat->setText("WRITE");
		ui->lbl_bat_model->setText("BAT Model");
		ui->lbl_DesignCAP->setText("Design Capacity");
		ui->lbl_ActualCAP->setText("Actual Capacity");
		ui->lbl_LoopCount->setText("Loop Count");
        ui->lbl_BatEFF->setText("Battery Health");
		ui->lbl_ManufacturerNo->setText("Manufacturer No");
		ui->lbl_SN->setText("Serial Number");
		ui->lbl_Mfrs->setText("Battery Manufacturer");
        ui->lbl_PD->setText("Production Date");
		ui->lbl_STAT->setText("Status");
		ui->lbl_Electricity->setText("Quantity of Electricity");
		ui->lbl_CellTemperature->setText("Cell Temperature");
		ui->lbl_VBATT->setText("Instant Voltage");
        ui->lbl_BatteryCurrent->setText("Instant Amperage");
        QString ManuName = ui->le_Mfrs->text();
        if(ManuName.size() > 0)
        {
            if(ManuName == "苏州顺达")
            {
                ui->le_Mfrs->setText("SHUNDA");
            }
            else if(ManuName == "深圳欣旺达")
            {
                ui->le_Mfrs->setText("SUNWODA");
            }
            else if(ManuName == "惠州德赛")
            {
                ui->le_Mfrs->setText("DESAY");
            }
            else if(ManuName == "常熟华普")
            {
                ui->le_Mfrs->setText("HUAPU");
            }
            else if(ManuName == "常熟新世")
            {
                ui->le_Mfrs->setText("XINSHI");
            }
        }
    }
    else
    {
        // F210
        ui->cbx_dev->setText("替换底层");
        ui->lbl_model_read->setText("机型选择：");
        ui->btn_mtsn_read->setText("读盖板码");
        ui->btn_mtsn_write->setText("写盖板码");
        ui->btn_read->setText("保存数据");
        ui->btn_write->setText("写入数据");
        ui->btn_upg->setText("升级");

        ui->te_mtsn->setPlaceholderText("盖板码");
        ui->te_file_write->setPlaceholderText("选择文件");

        ui->lbl_model_read->setMinimumSize(70,30);
        ui->lbl_model_read->setMaximumSize(70,30);
        ui->btn_link->setMinimumSize(80,35);
        ui->btn_link->setMaximumSize(80,35);
        ui->btn_link_bat->setMinimumSize(80,35);
        ui->btn_link_bat->setMaximumSize(80,35);
        ui->lbl_dev_ver->setMinimumSize(200,30);
        ui->lbl_dev_ver->setMaximumSize(200,30);
		
		// 电池修复
        ui->btn_read_data_bat->setText("读取");
        ui->btn_write_data_bat->setText("写入");
		ui->lbl_bat_model->setText("电池型号");
		ui->lbl_DesignCAP->setText("设计容量");
		ui->lbl_ActualCAP->setText("实际容量");
		ui->lbl_LoopCount->setText("循环次数");
        ui->lbl_BatEFF->setText("电池健康");
		ui->lbl_ManufacturerNo->setText("厂家编号");
		ui->lbl_SN->setText("序列号  ");
		ui->lbl_Mfrs->setText("生产厂家");
        ui->lbl_PD->setText("生产日期");
		ui->lbl_STAT->setText("状态");
		ui->lbl_Electricity->setText("电量");
		ui->lbl_CellTemperature->setText("电池温度");
		ui->lbl_VBATT->setText("电池电压");
        ui->lbl_BatteryCurrent->setText("电池电流");
        QString ManuName = ui->le_Mfrs->text();
        if(ManuName.size() > 0)
        {
            if(ManuName == "SHUNDA")
            {
                ui->le_Mfrs->setText("苏州顺达");
            }
            else if(ManuName == "SUNWODA")
            {
                ui->le_Mfrs->setText("深圳欣旺达");
            }
            else if(ManuName == "DESAY")
            {
                ui->le_Mfrs->setText("惠州德赛");
            }
            else if(ManuName == "HUAPU")
            {
                ui->le_Mfrs->setText("常熟华普");
            }
            else if(ManuName == "XINSHI")
            {
                ui->le_Mfrs->setText("常熟新世");
            }
        }
    }
}
// F210显示修复界面语言切换初始化
void MainWindow::F210_Code_Langure_Change_Init()
{
    if(LangureStu == 1)
    {
        ui->btn_disp_read_f210->setText("Read Data");
        ui->btn_disp_write_f210->setText("Write Data");

        ui->btn_link_disp_f210->setMinimumSize(120,35);
        ui->btn_link_disp_f210->setMaximumSize(120,35);
    }
    else
    {
        ui->btn_disp_read_f210->setText("保存数据");
        ui->btn_disp_write_f210->setText("写入数据");

        ui->btn_link_disp_f210->setMinimumSize(80,35);
        ui->btn_link_disp_f210->setMaximumSize(80,35);
    }
}
// 测试盒界面语言切换初始化
void MainWindow::TextBox_Langure_Change_Init()
{
    if(LangureStu == 1)
    {
        ui->cbx_dev_dlbox->setText("Replace underlying");
        ui->lbl_model_read_dlbox->setText("Selected model: ");
        ui->btn_mtsn_read_dlbox->setText("Read MtSN");
        ui->btn_mtsn_write_dlbox->setText("Burn MtSN");
        ui->btn_read_dlbox->setText("Save Data");
        ui->btn_write_dlbox->setText("Burn Data");

        ui->te_mtsn_dlbox->setPlaceholderText("MtSN");
        ui->te_file_write_dlbox->setPlaceholderText("Choose File");

        ui->lbl_model_read_dlbox->setMinimumSize(120,30);
        ui->lbl_model_read_dlbox->setMaximumSize(120,30);
        ui->btn_link_dlbox->setMinimumSize(120,35);
        ui->btn_link_dlbox->setMaximumSize(120,35);
    }
    else
    {
        ui->cbx_dev_dlbox->setText("替换底层");
        ui->lbl_model_read_dlbox->setText("机型选择：");
        ui->btn_mtsn_read_dlbox->setText("读盖板码");
        ui->btn_mtsn_write_dlbox->setText("写盖板码");
        ui->btn_read_dlbox->setText("保存数据");
        ui->btn_write_dlbox->setText("写入数据");

        ui->te_mtsn_dlbox->setPlaceholderText("盖板码");
        ui->te_file_write_dlbox->setPlaceholderText("选择文件");

        ui->lbl_model_read_dlbox->setMinimumSize(70,30);
        ui->lbl_model_read_dlbox->setMaximumSize(70,30);
        ui->btn_link_dlbox->setMinimumSize(80,35);
        ui->btn_link_dlbox->setMaximumSize(80,35);
    }
}
// 测试盒动态配置界面语言切换初始化
void MainWindow::TextBox_CFG_Langure_Change_Init()
{
    if(LangureStu == 1)
    {
        ui->te_file_read_cfg->setPlaceholderText("Choose File Path");
        ui->te_file_save_cfg->setPlaceholderText("Choose Save Path");
        ui->btn_file_read_cfg->setText("Choose");
        ui->btn_file_save_cfg->setText("Save To");
        ui->btn_file_out_cfg->setText("Configure");
    }
    else
    {
        ui->te_file_read_cfg->setPlaceholderText("选择文件路径");
        ui->te_file_save_cfg->setPlaceholderText("选择保存路径");
        ui->btn_file_read_cfg->setText("选择");
        ui->btn_file_save_cfg->setText("保存至");
        ui->btn_file_out_cfg->setText("配置");
    }
}
// 电池循环界面语言切换初始化
void MainWindow::b316_BatLoop_Langure_Change_Init()
{
    if(LangureStu == 1)
    {
        ui->btn_read_f316->setText("Read");
        ui->btn_write_f316->setText("Write");
        ui->btn_default_f316->setText("Default");
        ui->btn_upg_f316->setText("Upgrade");
		ui->tip_f316->setText("Tip: The 'C' of charging current and discharging current is the cell capacity");
		
		ui->lbl_cc_f316->setText("Charge Current");
		ui->lbl_cctime_f316->setText("Charge Time");
		ui->lbl_dc_f316->setText("Discharge Current");
		ui->lbl_dctime_f316->setText("Discharge Time");
        ui->btn_link_f316->setMinimumSize(120,35);
        ui->btn_link_f316->setMaximumSize(120,35);
    }
    else
    {
        ui->btn_read_f316->setText("读取");
        ui->btn_write_f316->setText("写入");
        ui->btn_default_f316->setText("默认");
        ui->btn_upg_f316->setText("升级");
        ui->tip_f316->setText("注：最大充电电流和最大放电电流的'C'为电芯容量");
		
        ui->lbl_cc_f316->setText("最大充电电流");
		ui->lbl_cctime_f316->setText("充电静置时间");
        ui->lbl_dc_f316->setText("最大放电电流");
		ui->lbl_dctime_f316->setText("放电静置时间");
        ui->btn_link_f316->setMinimumSize(80,35);
        ui->btn_link_f316->setMaximumSize(80,35);
    }
}
// dl8000界面语言切换初始化
void MainWindow::dl8000_Langure_Change_Init()
{
    if(LangureStu == 1)
    {
        // 
        ui->lbl_model_read_dl8000->setText("Selected model: ");
        ui->btn_mtsn_read_dl8000->setText("Read MtSN");
        ui->btn_mtsn_write_dl8000->setText("Burn MtSN");
        ui->btn_upg_dl8000->setText("Upgrade");

        ui->te_mtsn_dl8000->setPlaceholderText("MtSN");

        ui->lbl_model_read_dl8000->setMinimumSize(120,30);
        ui->lbl_model_read_dl8000->setMaximumSize(120,30);
        ui->btn_link_dl8000->setMinimumSize(120,35);
        ui->btn_link_dl8000->setMaximumSize(120,35);
        ui->lbl_dev_ver->setMinimumSize(380,30);
        ui->lbl_dev_ver->setMaximumSize(380,30);
    }
    else
    {
        // F210
        ui->lbl_model_read_dl8000->setText("机型选择：");
        ui->btn_mtsn_read_dl8000->setText("读盖板码");
        ui->btn_mtsn_write_dl8000->setText("写盖板码");
        ui->btn_upg_dl8000->setText("升级");

        ui->te_mtsn_dl8000->setPlaceholderText("盖板码");

        ui->lbl_model_read_dl8000->setMinimumSize(70,30);
        ui->lbl_model_read_dl8000->setMaximumSize(70,30);
        ui->btn_link_dl8000->setMinimumSize(80,35);
        ui->btn_link_dl8000->setMaximumSize(80,35);
        ui->lbl_dev_ver->setMinimumSize(200,30);
        ui->lbl_dev_ver->setMaximumSize(200,30);
    }
}
